package cn.edu.gzist.chapter08kafka.controller;

import org.apache.kafka.clients.producer.KafkaProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.UUID;

@Controller
public class TestController {

    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;
    @RequestMapping("/api/test")
    public void test01(){
        String uuid = UUID.randomUUID().toString();
        System.out.println("test = "+ uuid);
        String topic = "test = "+ uuid;
        kafkaTemplate.send("test_topic", topic);
    }
}
